
/**
 * 生成路由
 * @param {路由数据} menus 
 * @returns 
 */
export function generateIndexRouter(menus) {
    let items = []
    for(let menu of menus) {
      let item = {}
      item.redirect = menu.redirect
      item.path = menu.path
      item.hidden = menu.hidden
  
      let componentPath = resolve => require(['@/' + menu.component +'.vue'], resolve)
  
      item.component = componentPath
      let meta = {}
      meta.icon = menu.meta.icon
      meta.title = menu.meta.title
      item.meta = meta
      item.name = menu.name
      if(menu.children != null) {
        item.children = generateIndexRouter(menu.children)
      }
      items.push(item)
    }
    return items
  }